﻿using System.Collections.Generic;
using ManageSystem.Model;
using ManageSystem.IRepository;
using System.Threading.Tasks;

namespace ManageSystem.Repository
{
    public class IncomeStreamRepository : BaseRepository<IncomeStream>, IIncomeStreamRepository
    {
        public async Task<List<IncomeStream>> QueryIncomeStreamByProjectGuid(string projectGuid)
        {
            return await Db.Queryable<IncomeStream>().Where(it => it.projectGuid == projectGuid).ToListAsync();
        }

        // 删除项目时删除与其相关的收入流水
        public async Task<int> DeleteIncomeStreamByProjectGuid(string projectGuid)
        {
            return await Db.Deleteable<IncomeStream>().Where(it => it.projectGuid == projectGuid).ExecuteCommandAsync();
        }
    }
}
